<template>
	<view>
		<view class="order-pay-z" @tap="$emit('show_choice_timu_list',false)" style="position: fixed;"></view>
		<view class="tika" style="position: fixed;">
			<view class="order-pay1">
				<view class="questionBankAnswer-dc" v-if="question_type == 'test' && my_res.right_num != undefined">
					<view class="questionBankAnswer-dc-flex">
						<view class="iconfont icon-dui"></view>
						<view>{{ my_res.right_num }}</view>
					</view>
					<view class="questionBankAnswer-dc-flex">
						<view class="iconfont icon-cuo"></view>
						<view>{{ my_res.error_num }}</view>
					</view>
				</view>
				<view v-else-if="question_type == 'exam'" class="questionBankAnswer-r" style="color: #000;"
					@tap="jiaojuan1">
					<view class="iconfont icon-bianjisekuai"></view>
					<view>交卷</view>
				</view>
				<block v-if="show_remove">
					<question-remove class="questionBankAnswer-bottom" @removeError="removeError"></question-remove>
				</block>
				<block v-if="type != '' && show_fav">
					<question-fav class="questionBankAnswer-bottom" :current_timu="current_timu"
						@collect_opt="collect_opt" :type="type"></question-fav>
					<view class="questionBankAnswer-dc">
					</view>
				</block>
				<view v-else></view>
				<view class="questionBankAnswer-r">
					<view class="iconfont icon-fenlei"></view>
					<view class="questionBankAnswer-r-menu">
						<span>{{ timu_order }}</span>
						/{{ total_num }}
					</view>
				</view>
			</view>
			<view class="tika-content">
				<block v-for="(item, index) in timu_list" :key="index">
					<!-- 章节练习 -->
					<block v-if="question_type == 'test'">
						<view @tap="choice_timu_by_id(index)" class="tika-content-n green-background"
							v-if="item.state === 2">{{ index+1 }}
						</view>
						<view @tap="choice_timu_by_id(index)" class="tika-content-n red-background"
							v-else-if="item.state === 1">{{ index+1 }}
						</view>
						<view class="tika-content-n" v-else-if="item.state === 3" @tap="choice_timu_by_id(index)">
							{{ index+1 }}
						</view>
					</block>
					<!-- 考试 -->
					<block v-else>
						<view @tap="choice_timu_by_id(index)" class="tika-content-n orange-background"
							v-if="item.state === 1">{{ index + 1 }}
						</view>
						<view class="tika-content-n" v-else-if="item.state === 0" @tap="choice_timu_by_id(index)">
							{{ index + 1 }}
						</view>
					</block>
				</block>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			show_remove: {
				type: Boolean,
				default: false,
			},
			show_fav: {
				type: Boolean,
				default: false,
			},
			current_timu: {
				type: Object,
				default: function() {
					return {}
				},
			},
			type: {
				type: String,
				default: ''
			},
			question_type: {
				type: String,
				default: 'test'
			},
			my_res: {
				type: Object,
				default: function() {
					return {}
				},
			},
			timu_list: {
				type: Array,
				default: function() {
					return [];
				},
			},
			timu_order: {
				type: Number,
				default: 0,
			},
			total_num: {
				type: Number,
				default: 0,
			},
		},
		watch: {
			current_timu: {
				handler(newVal, oldVal) {
					// console.log(newVal)
				},
				deep: true,
				immediate: true
			}
		},
		data() {
			return {
				show_choice_timu_list: false
			}
		},
		methods: {
			choice_timu_by_id(index) {
				this.$emit('choice_timu_by_id', index)
			},
			//考试交卷
			jiaojuan1() {
				this.$emit('jiaojuan1')
			},
			collect_opt() {
				this.$emit('collect_opt')
			},
			removeError() {
				this.$emit('removeError')
			},
		}
	}
</script>

<style>
</style>
